// config/config.ts
export const config = {
    explorer:"http://38.6.216.42:9996/",
    ipfs:{
        host:"38.6.216.42",
        port:5001,
        protocol:"http"
    },
    ipfs_gateway: "http://38.6.216.42:8080/ipfs/",
    ipfs_webui: "http://38.6.216.42:5001/webui",
    dao_chain_name: "chain1",
    dao_contract_name: "dao",
    getUrl(url: string): string {
        if (url.startsWith("ipfs://")) {
            return config.ipfs_gateway + url.slice(7); // 去掉前缀 "ipfs://"
        }else{
            return url;
        }
    },
    formatTime(unixTimestamp: string): string {
        const timestamp = parseInt(unixTimestamp, 10);
        const date = new Date(timestamp * 1000);
        date.setHours(date.getHours() + 8); // 转北京时间
        return date.toISOString().replace('T', ' ').substring(0, 19);
    }
};